Slight refactoring to improve code quality