Update variable names
Rewrite macro to avoid having global static variables