Code refacotring