build tables automatically