Added documentation

A bit of documentation was added to the whole body of code.