Improved code about set command