improved generator is working. n>4 is still very slow