Refactored and updated documentation.