code for cutting tree