added some cut! expressions to prevent backtracking in cases where it is futile