Bugfixes, added a few features.