applied suggestions from code review