Added a way to flatten a command list.