code clean up and code review comments added