replace redirects in controllers with render json where it makes sense