Edited getEncoder method.