Remove static variable and use macros