reworked key generation
changed interface for key generation