encoder works for the most part