Better testing for transformations, and many bugfixes.

Closes several open issues.