Initial work on keygen.