refractured code