Generalizing cut function for other cases