Clean up encoder with use of traverse module. Adding a hacked version of the string encoding library for proper UTF support.
Fixing a bug where the SWITCH_PAGE was not set.