minor tricks that roughly halve generation time
misc fixes