Massive performance improvements, refactoring, bugfixes, more tests.