Improved documentation; small bit of refactoring.