Moved trimming to injected script, saving a lot of work in the popover