Moved flags to main.go and added test cases.