DRYs up some code.
Merge pull request #106 from Cerberus98/dry

DRYs up some code.