updated script with $(this)