improve the macros a bit and add some crude tests.