Removing code duplication
Merge pull request #3487 from timvandermeij/remove-code-duplication

Removing code duplication