Refactoring to add more test coverage
Removed IsCommand flag which was confusing