Restructured the code to three files instead of one main file and ported it to OOP (kinda). I believe it's much easier to use/read it now.