some light re-org
add a couple of helper functions/macros for general use