Remove duplicate code
Merge pull request #337 from damonjones/remove-duplicate-code

Remove duplicate code