refactored for separate factory directory