Add append mode
Add unit test for appending