added writing everything out to files and printing out the partition