Improved vectorizeString function and made it private member function