updated the cut function