Added truncate method and refactored bestfit to remove duplicate code