added comments and some code clean up