Full implementation of truncate