modified and corrected ruby file exercise7