Move all subcommands to functions and reuse them