Finalized Code.
Fixed comments