updated populate function