address @brianhw comments, adds few tests for exception handling