added  result function (untested)