Further bugfixes and enhancements.