refactoring, renaming, templatization of AAGScheme::KeyGenerator,
made code DRYer