improve Trim&Extend