Cool, this is what I was looking for - didn't like having all these err instances in the function