pattern matching for table lookup, probably created quickEncode on a high level