Refactored main to class and it ran flawlessly. I'm scared o_o