Refactored main.go