created Truncator class and tidying up