Added further checking if there are tables