Added range calculation for measures; extracted difficulty calculation into a separate function.