comments and code tidy from #1366