Modified to work with json data.