Added cmdparser to read commands from input.
Improved cmdparser command finding algorithm.