Refactor macros