moved the cross domain stuff into the scan function