Move $index, $title and $where to global