Fix some problems and extend and update documentation.