Some doc enhancements
Some refactoring.