Fixed syntax errors and added a prepopulate database function