Moving exception handling around a bit