findCommand function added.