refactored the UpdateQuality() method