Added preventative error catching.