Overhaul of code, plugin system, robuster cache system.

Hope this doesn't break anything :3