Code refractored.