Updates to add some error checks.