Bugfixes, refactoring, new design