Fixed command list generation

Command list now has commands to a node that makes sense. Distances were
right, but some commands were being overwritten.