implementation of main DB file, interacting with shards