Initial commit.

Basic working implementation.

TODO:
* More tests
* More comments