Restructure plain text backend encoder using a hash table rather than a big nested if/then construct.