Code refacotoring