This should be $string, not $str