organized code, added comments