last version with old permutation strategy

using bins instead of direct matching