optimize cleanup operation.