replace macros with static functions