refactored controller
finished product