Add better exception handling.