Move flag parsing into tool Main