Moved response code to use a switch/case (instead if giant if/else)