Added function comments. Removed some unnecesary commented code.