How are you incrementing the timevariable? From what I can tell the timevariable will always be 0.