refine macros for more clear control flows