Bugfixing and some minor improvements.