Change the responses to be JSON and and more unit tests around it