consolidate some WHEN functions
a little more consolidation
index_string done