[tz] [PROPOSED] Refactor by using max and min macros