entrySet refactored to forEach