Implemented key generation