modified trimming middleware