Writing and executing scripts