optimize the scripts and codes