Fix compile-time errors. Continue migration of code to service-based approach for encoder.