refactored main.go