Worked on populate function. Sort of working, need to debug.