We present a new method for calculating the merger history of matter haloes in hierarchical clustering cosmologies. The linear density field is smoothed on a range of scales, these are then ordered in terms of decreasing density and a merger tree constructed. The method is similar in many respects to the block model of Cole & Kaiser but has a number of advantages: (i) it retains information about the spatial correlations between haloes, (ii) it uses a series of overlapping grids and is thereby much better at finding rare, high-mass haloes, (iii) it is not limited to haloes whose mass ratios are powers of two, and (iv) it is based on an actual realization of the density field and so can be tested against N-body simulations. The major disadvantages are (i) the minimum halo mass is eight times the unit cell with a corresponding loss of dynamic range, and (ii) occasionally the relative location of haloes in the tree does not reflect the correct ordering of their collapse times, as computed from the mean halo density. We show that our model exhibits the required scaling behaviour when tested on power-law spectra of density perturbations, but that it mimics peaks theory in predicting more massive haloes for flat spectra than does the Press-Schechter formalism.