added comments
removed inner function call