change error handling to be more go-like