commit 2

cleaned up code and added comments