Srb/json tree building refactoring and basic integration testing