improved fitness function