Save groups to a file for debugging purposes
Search in itself even when the loop is large.

Normally large searches are skipped, but they shouldn't be skipped when they are compared with themselves. This fixes a bug when for large loops there was no search data at all.