Rewrote to use namespaces, among other things.