refactor and json