Updated documentation and did a minor refactoring for readability.