Add the getDifficulty function