Started refactoring data structures
More refactoring and json test