Various scripts improvements