add getcom command;optimized code