Refactored fetched results controller code