slight improvements, generalized macros