working on encoder