adding a smart_truncate method that respects word boundaries