restrucuting code