Updated code for the review. Removed some unneeded modifications.