refactoring sorterState to Map queues