General housekeeping and pruning