finished with cutting algorithm