added races table to horse race algorithm