Added some debugging and sudo -E support