Init database and saving statistics