refined CommandExecutor and added test cases