refactored model creation