test fixes
more fixes
refactor for JSON