Updated key generator