refactored factories