Code for extraction