Created (but not tested) truncate and few auxiliary functions