Zaslat SMS: Building merger trees from cosmological N-body simulations