generic factories
Merge branch 'factories-refactor'