Source and tests

* Wrote all tests.

* Finished the source files (forgot to add into the previous commit).