updated nounce function