added performance enchancement: break on gains <= epsilon