added sudo code for functions