Implemented table-based encoding.