better exception handling.