changed add function to append to file