move active_devices to global
oops
filter
seems to work