add logging & error checking to `utility` function