added comments and cleared up some things