Scope the exception handling a bit better.