new way to implement db, still not working