Recoded the scripts