Corrected Ruby Code