refactored macro driving code