Added feature extraction, refactored