Replaced global variable $data with $smof_data.