Documentation update and slight refactoring.