Added truncate function to functions