Added more url encoding in the beginning of the script, fixed ctrl-c, added sudo check