refactor to use json