Added namespaces as well as removed global variables