samples code corrected