Refactored code again