Update the script to run in headless mode