Re-add state persistence with support for the new queue. This should finally finish the new queue system.