Added dictionary to have mono and poly versions of the algorithm