updated trim script