refactor macros