added coomments to the code, explaining how the different requests and responses work