Minor code refactoring