Implemented expand and generate