DRY refactoring
Merge pull request #29 from Nss/DRY

DRY refactoring