Split up file.go into more clear parts