removed some logging and added comments