Make magic constant '2' more explicit.
Move BSSID similarity filter to after database query, to improve hit rate.