result function beginning