Made queue selection logic clearer.