Bugfixes, organizing things better