Some minor changes in the above patch.
Thanks!