Attempted to refactor using macros