Fixed some bugs.
Major change of the output encoding in JavaScript.

This new encoding does not clutter the top-level namespace, and
things are more readable on the whole. It also allows to plug in
native implementations for @native methods.