cleanup
added tests for toJSON