Refactoring the products controller to repond to JSON