Code Documentation.

Added doc string to all the functions and described snippets at some
places.

Signed-off-by: Srijan Mishra <srijan23mishra@gmail.com>