Refactored model loading