Updated controller to return json to pass tests