minor changes, added additional comments and slightly restructured the generation calls for protocols