Script engine improvements