Minor refactoring / code cleanup