ruby logic added