added comments, cleanup