I added user authentication
added try and except clause