Intelligibility improvements

Made things more intelligible by improving explanations in both
function descriptions and comments, by formalizing all function
descriptions, by giving certain variable names more explanatory value
and by making some code parts more concise.