added db
copied further from php