improve calculation of dependency