updated code for hasKeys