issue #4900, refactor