Updating redirect logic