Added timeToCheck variable and element handlers