tried refactoring json class.. doesn't work yet