Fixing stuff

Renamed a bunch of things, modified the code a bit, and fixed some bugs.
Next build: clean up code!