Semi-decent error handling.