add difficulty calculation to rewards function