converted some CONSTANTs to #define s