Added a smudge of error checking.