Refactored code (2)