lots of changed to implement the json responses