improve the macro definition
improve the exception handling in main function
[improvement] canonicalize naming
[improvement] remove unused macros