better way to do doc generation