Refactor and modify ModCommandHandler.