I have refactored these factory functions