Reorganized the whole codebase. It's a bit easier to follow now.