removed unnecessary code, added comments