made some changes after code review