very minor aesthetic and commenting edits in mode summary function