added comments and a bunch of other stuff