Various bugfixes and layout improvements