Added trim() to text before processing for widows