Refactoring + some new code for factory objects