transferred code from wifimap experiment