Added new functions.
Refactored code.
Updated documentation.