Code cleanup.
Better queue algorithms.