Database functions implemented