Improved encoder/encryptor design with dependency injection