added computation of f