Implemented key handling for generator