Cleaned up the code a bunch, refactoring things into different or more relevant files. Restructured ./tests and the Makefile.