Bugfixes, improved API