Minor improvements, buxfixes, error handling, documentation.