refactored model