Added funtion to extract tables