added descriptions

included the descriptions of the functions and step by step workings, as
far as i was able to understand