Added test cases.
Moved automatic hashing into a separate category.
Error conditions now raise exceptions.