build_db now fully working