Moved inner macros inside so they are scoped correctly for function expressions.