Refactored code again: