Code cleanup, refractored code.