Working code. Some tests. Not fully tested. v0.0.1