Add documentation and small fixes