major refactoring of truncate method