Issue 6557: Some code improvements #3