Added tests, mostly for the canonicalize() function. They arent passing as of yet, though.