moved factory to it's own file