improved script a bit