using arrays for json now, much better
refactored to work with new php