Refine command type and modify the related code