Refactored the documentation slightly

Also some other cosmetic changes.