refactor: use key.compare() to replace operator<()