Encoder uses visitor pattern