Moves factory logic into its own folder.