add a few comments and minor stylistic changes