Corrected Ruby code