try to reduce code climate reported code smell
further simplification
Merge pull request #39 from nlf/reduce_duplication

Reduce duplication