adding error catching