added first implementation of truncate (must be refactored)