First commit where the reader actually works.

* Added reader tests.
* Fixed pointer bug in the decoder and added tests.
* Fixed many small issues in the reader.