ref #4021, #4066 -  refactoring and merging
Merge remote-tracking branch 'origin/master'