working and populating table correctly