more refactoring to allow orm selection, still some broken endpoints