Minor refactoring

[skip ci]
Merge branch '1.6' into 1.7

[skip ci]
Merge branch '1.7' into 2.0

[skip ci]