removed unneeded logging, formatted code, added comments