Comments added for functions.
Removed superfluous dead/commented out code.