refactored to return json array