Refactor to get json data from remote server.