Performance improvements...  That big switch statement has an exceptionally
crappy Big-O(tm) notation, move the index lookup to an array...