Reorder next url implementaion for better redirects