replaced #defines with inline functions (nw)