prepopulate db function now working as intended