Reconfigured databases

Plus fixed bug with the frequency of writing to the databases