Finished refactoring of all the code, should all follow a standard style and formatting.