minor refactoring after code review