Refactored using modules

* Added modules to all declarations
* Changed casing of all functions
* Changed visibility of all functions
* Moved classes around