make changes suggested by @EkkiD, add some other comments, small cosmetic changes