Refatoring cli.Main.