Fully documented code

The code for all files is now documented. Explaining the use of each
function and structure.