Added lots of tests and removed some aliasing bugs.