Cleaning up command iterator