extract some shared logic into a utility function
Merge branch 'master' of github.com:gengo/napoli