Move file loading and writing to dedicated methods.