Code to extract features