Added some error handling
Added test suite.  All specs passed.