almost implemented Database
minor changes