feature extraction code cleanup