Minor code cleanup / refactoring