Added optimisation pragmas.
Refactoring the queue strategies.