updated controller to render json