Implemented key generation. Closes #5