optimize input generator