[IMP] assignation algorithm factorized + minor improvement