many improvements to comments and style