Beginning of code cleanup

Restructured and commented code in select source files.

Added list of used library versions to the readme document.