minor cleanups and better comments