Loads of bugfixes. First working version of the system.