Refactored flags and used those to enable conditional macros to more

easily be written to avoid clobbering many tests.  Also implemented
this for n vs. nx index lookup.