added check if dir exists, removed a few sudos