Added tests for namespaces.
Hotlinked link.
Refactored to make responsibility clearer.