add prune and isEmpty