added a bit of script magic