Minor refactoring to make code more readable