refactr code