database

all logic from thedatabase