removed duplication in the GET and POST requests