refactor bind_key_handler