database mostly working