partially working middleman doc gen