extract features

implementation of helper function for feature extraction