Refactor a bit, add subcommands