Refactored some code to just make it better looking and easier to read. Everything still works as well as it did in the last commit (which was mediocre at best).