added queue reordering (pre-solution refactor, but using solution for a few things)