Updated main.go to handle errors.