added save method and tests.