Add exception definition macro
Do integrity checking
Exception handling and more test cases