The excursion set model provides a convenient theoretical framework to derive dark matter halo abundances . This paper generalizes the model by introducing a more realistic merging and collapse process . A new parameter regulates the influence of the environment and thus the coherence ( non-Markovianity ) of the merging and the collapse of individual mass shells . The model mass function also includes the effects of an ellipsoidal collapse . Analytic approximations of the halo mass function are derived for scale-invariant power spectra with the slopes n = 0 , -1 , -2 . The n = -2 mass function can be compared with the results obtained from the ‘ Hubble volume ’ simulations . A significant detection of non-Markovian effects is found for an assumed accuracy of the simulated mass function of 10 % .