Moved factory to get classes to its own module.