Bugfixes and style tweaks