minor code refactoring.