Added an example to the documentation and various comments throughout the code.