Replace large if or conditionals with switch/case for URL encoding