Add documentation and make related tweaks