Validated references, updated namespaces

It now compiles. Should be ready to ship then!