Refactored code using self syntax