refactored whitelisting + redirects into functions

among other similarly small changes
Merge branch 'master' of https://github.com/cblgh/pirate-curl