Major rewrite. Created separate files for the classes and refactored and standardized the code.