Rework command queue to handle dependencies and inconsistencies
correctly.