updated code for simpler JSON and added request response feature