docs: Improve documentation to describe the usage of the functions.

In addition remove wrong return types marked by the analyzer