refactor main.go