minor code refactoring