Refactored controllers to avoid defining on public scope