Divided the scripts due to threads problems