added namespaces + several 3.7 optimisations