JSON && some refactoring