preparing database