Add automatic code generation for extraction