Refactor comparison into spaceship method