database functions improved.