made this script a little better