Simplified encoder and decoder.