refactor messy inline function to macro