added comments, and removed some code