changed way of database connection