More improvements on the script