added comments for a few functions and removed some unncessary code