Relay code loop issues

the "int" data type only gets as big as 32,767
try using "long" for waittime

But I don't see you even using waittime in the code so it won't change anything other than being proper for that part.