refactering code