Moved factory code into configuration object.