code cleanup factory