replace horrible #define with horrible globals