implement json, bug fix, and testing