Added trimming functionaity