Bugfixes, cleaning