Restructured the code. Compiles, but still broken.