improved filtering..one function now handles all map filtering