bug fixes and commandList change

command list now prunes commands that have no attributes

dist++ was being passed in, now dist + 1. Should behave correctly now.