move sudo to top of the script