modified function called for timelimit