Fixes #4670
refactor code
added testRemoveMethodInsensitive
Merge pull request #5831 in master
Merge pull request #5567
Merge pull request #5567 in develop