LibOfLegends code updated and rewritten.