Lots of changes. Adding tests.

Nothing is done. What is this commit?