Generator : Polished the generator code