minor corrections to code and comments