more algorithm research & fixes