Added 3 modes, append, filename & overwrite