Code refactoring and new JSON view