added duplicate number check.