rearranging controller.rb