Improved generator for tests