Added truncate function.