wrap non-dry run case in else to avoid having return outside function scope (confuses jscoverage or uglify)
restructure so the core code can be used as a library