Made error API more grammatical, fixed bug and added unit tests