refactored munge/generate-redirects.sh