Added time limit to logic