Proper algorithm choser. Still TODO.