half way done with encode.
finished basic encode