More accurate command searching and a new test for sub commands