added comments and removed unused stuff