Refactoring controller a_template_cats