Changed some toJSON calls to a more pure attributes clone. Added a commit method to clear the change history