Cleaned the codebase and removed a lot of obsolete code.