optimize not naive seems to work
still bugged
algo seems OK, but not so efficient finally
dmqh_new
apply dmqh_new