Tried to make it more modularized by splitting the code up across source files.. Realizes what a giant undertaking this is and gives up..