added toJSON method.
implemented clone method and isRefrence method.