Made som changes to encoding of examples.

And fixed a bug.