Improved the macros to account for infinity