Minor refactoring and fix links on the README

Extracts a few instances of code duplication.  

Raises the code-climate score from a 1.98 to a 4.0.  Also fixes some broken links on the readme.