Better file structure and database population code