updated after code review