Separated datastate and database