added comments, removed debug