tested script. fixed sudo issue