Fixed mistakes in the canonicalization regular expressions and altered the functions to use a source and destination buffers. This reduces the amount of memory allocations that take place. Added more canonical query tests to the internal test suite.