added truncate function

for testing purposes