ruby code from fogelberg