minor refactoring for code cleanup