Made function for redirecting that works better than existing usage