cleaned up and added json tests