Added comments and coding style to previous pull request #771