Clean up queue code