refactored example controller