Bugfixes and add export capability