a bit of cleanup and helper macros