added some comments as well as removed some extra code