Updated code to read from JSON