format and refract some code