Changed the way keys are generated