Revamp both exceptions and test cases.