fix for issue #41 and minor refactors for DRY
Merge pull request #44 from njasm/fix-41-hhvm-and-hhvm-nightly

fix for issue #41 and minor refactors for DRY