added changes to the main program to use the encoder class.  There are a lot of errors here as I assumed the name of a lot of methods and properties of the encoder class.