changed the way database population works and made a template