made key handler more simple