more params, better check

Added additional parameters,
changed the user check to a more compatible method,
added request for sudo if not root.