Move redirect code out of conditional window.isloaded block so redirects happen faster