Using macros to reduce the loc, and condensing the tests