fixed cs, added comments, reverted unrelated changes