make sudo() wrapper smarter
miscellaneous cleanup