Bugfixes and tweaking.