corrected $var to $title, made stylistic changes