if(millis() > time_now + timeout) will not execute when the previous ifs are false.
Learn how to use &&