[REFACTOR] abstract most file manipulation away from server class
[REFACTOR] clean up file writing methods