Change serialize to replace functions and regexps with switch statement
Improve namespace rendering

Removes the initialization of the leaf namespaces, since exposed values
will be assigned to them. The algorithm was also simplified.

Closes #1
Merge pull request #3 from yahoo/leaf-namespaces

Improve namespace rendering