added comments, erased unused code