Refectored code