Finalizing database