added db connection and begun check function