Move all useful functions to the qmk module and use the cli subcommand as a wrapper around it. Add both inline comments and documentation.