changed a little bit of the outputfile writing and changed some variables to long int's instead of double