Optimizing algorithm done.