cleaned up some code
added comments to code