Refactored for JSON