CodeClimate

This change refactors some code to remove duplication.
Merge remote-tracking branch 'upstream/master'