added docstring addressing high level concept and both your questions.