Remove code duplication
Merge pull request #199 from Helabs/improvements/remove-code-duplication

Remove code duplication