Added Error classes
Re-formulated a couple of unit tests
Fixed a couple of bug and added a couple of tests