Optimization of remove method