Refactor respond_to to use respond_with