First framework of functions
Removed all static variables

* Code is still a gigantic piece of shit.
* Naming convention is mixed between my code and the old code.
* It may leak memory, won't know for sure until some tests are written.