Added Encoder constructor with parameters