Updated error handling. Saved outputs.