Refactored to reduce controller code (moved to model)
Refactored to reduce controller code (moved to model)
Refactored to reduce controller code (moved to model)