Code cleaning

This is to merge a code after cleaning suggested by Chris in comments to #6687. 
The modifications are not substantial, so should this PR be backported to 73X?