Doc gen code cleanup