Refractored code