Update way to connect to database, new instance in check method