Add documentation and some small changes.