move factory definitions into relevant modules, to free up top-level