Added sudo improvements and saferun function