Improve the script's performance