Use poor man's generics (aka macros) to reduce repetative code