Added command count guard