Documentation

Documented the functions to explain what they do.