Bugfixes and adding samples for documentation.