Moved pattern matching into separate file.

Also removed useless k property.
Reduced memory allocations.

Using passing by reference instead to re-use items.
Cleaning up memory.

Reduced number of inits in building the printer.
Added free functions to free up memory after use.
Started work on matching with all VOs.