Modified code to find first table instead of second