Updated key handler