Replaced while loop with clearTable func