added encoder stuff