Added considerable code to generate a feature vector.