Added documentation to some of the functions