Sequence problems fixed, new encoding method