Small tweaks
Removed redundant sudo, added while loop and root user check.