add previsit and postvisit