modified code to use getMacro