converted macros to inline funcs