Added some more documentation of functions