docs for truncate; minor code tidy-up