updated for JSON parsing