Added an early abort condition to avoid waisting hours on impossible solutions.