Changed population of database to separate function.