Simplify some macros
Implement core unittests