Simplified CommandQueue a bit by improving the code in addCmd and removing redundant tests in runQueue