better script handling