key generator rework