updating controllers to support JSON