Add command, patternfinder, and improve unit tests