adds tests and more error handling

also updates readme and package.json