minor: reduce code redundancy
Merge pull request #7 from briceburg/master

minor: reduce code redundancy