changing order of database building