upgrade to error handling

resolves #2