Updated the comments and added try catch for the doget method