improved merging and solved a problem with longer words and maxgramsize now 30