works but populateTable seems to run twice