Refactoring to improve code readability