database is almost working