ajusting the logic