Use extract method to uncomplicate compile_hash

This addresses two concerns identified through code climate:
compile_hash is very complex and has duplication.

DRYing up setting population to address duplication.

Using extract method on other bits of logic to clean up this method.
Merge pull request #510 from bhicks/code-climate-improvements

Use extract method to simplify compile_hash