added error catching back in