Added inline docs for several functions