code refactoring - file.go