Added toJSON method