rewrote the script