Added truncate words function