Corrected the population script. now works with 2 tables