Documentation, plus cleanup for a few code paths