Simplifying index.js by extracting core/redirect.js