Also fix some bugs found when refactoring
Note: old command options `--set` and `--set-keyless` were removed. To reuse custom module, JSON config must be used.