test improvements and added clearer to/fromJSON