Refactor: Prefer min/max algorithms over macros