update to sudo code and setup of functions