Open datafile in append mode

Rename some functions to better describe their function
Fix setting the number of coincidences