Moved everything into a class/namespace for use as a module