Adds tests and Travis-CI; more robust error handling.