added tests for saving and cleanup