More commented new version of the code.