Writing maintenance scripts