modified script a bit