more idiomatic err handling