Added next for table checks to main