Added check to avoid adding the same command to the history repeatedly