Code for feature extraction